import {
    DIC
} from '@/const/dic';
import {
    timeFormatter
} from '../formatter';
import Store from '../../store/';
const allPermission = Store.state.user.permission;
const isAdmin = Store.state.user.userInfo.superAdmin;
export const menuTableOption = {
    border: true,
    index: true,
    selection: true,
    calcHeight: 350,
    columnBtn: false,
    searchClearable: false,
    selectClearBtn: false,
    searchResetBtn: false,
    height: "auto",
    menu: true,
    menuAlign: "center",
    searchBtn: true,
    labelWidth: 120,
    refreshBtn: true,
    tip: false,
    addBtn: true,
    dialogWidth: '800px',
    dialogHeight: 'auto',
    menuWidth: 180,
    editBtn: isAdmin || !!allPermission['/menu/edit'],
    viewBtn: false,
    delBtn: isAdmin || !!allPermission['/menu/remove'],
    column: [{
            "label": "菜单名称",
            "prop": "title",
            "search": true,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "row": true,
            "minWidth": "120",
            "readonly": false,
            "span": 24,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请输入菜单名称",
                "trigger": "blur"
            }]
        },
        {
            "label": "封面",
            "prop": "cover",
            "search": false,
            "type": "upload",
            "fixed": false,
            "width": "auto",
            "row": true,
            "minWidth": "120",
            "readonly": false,
            imgHeight: 60,
            imgWidth: 'auto',
            "span": 12,
            "display": true,
            "hide": false,
            "listType": "picture-img",
            "showFileList": false,
            "action": "/upload/image",
            "tip": "只能上传jpg/png文件，且不超过500kb",
            "rules": [{
                "required": true,
                "message": "请输入封面",
                "trigger": "blur"
            }]
        },
        {
            "label": "菜单类型",
            "prop": "menu_type",
            "search": false,
            "type": "select",
            "fixed": false,
            "width": "auto",
            "row": false,
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请选择菜单类型",
                "trigger": "blur"
            }],
            "placeholder": "请选择菜单类型",
            "dicData": DIC["menumenu_typeDic"]
        },
        {
            "label": "等级",
            "prop": "level",
            "search": false,
            "type": "tag",
            "fixed": false,
            "width": "auto",
            "row": false,
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请选择等级类型",
                "trigger": "blur"
            }],
            "placeholder": "请选择等级类型",
            "dicData": DIC["menulevelDic"]
        },
        {
            "label": "页面路径",
            "prop": "page_path",
            "search": false,
            "type": "text",
            "fixed": false,
            "width": "auto",
            "row": false,
            "minWidth": "260",
            "readonly": false,
            "span": 24,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请输入页面路径",
                "trigger": "blur"
            }]
        },
        {
            "label": "创建时间",
            "prop": "create_time",
            "search": false,
            "type": "datetime",
            "fixed": false,
            "width": "160",
            "row": false,
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false,
            "hide": false
        },
        {
            "label": "修改时间",
            "prop": "modify_time",
            "search": false,
            "type": "datetime",
            "fixed": false,
            "width": "160",
            "row": false,
            "minWidth": "120",
            "readonly": false,
            "span": 12,
            "display": false,
            "hide": false
        },
        {
            "label": "排序",
            "prop": "sort",
            "search": false,
            "type": "number",
            "fixed": false,
            "width": "80",
            "row": false,
            "readonly": false,
            "span": 12,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请输入排序",
                "trigger": "blur"
            }]
        },
        {
            "label": "状态",
            "prop": "status",
            "search": false,
            "type": "tag",
            "fixed": false,
            "width": "80",
            "row": false,
            "readonly": false,
            "span": 12,
            "display": true,
            "hide": false,
            "rules": [{
                "required": true,
                "message": "请选择状态",
                "trigger": "blur"
            }],
            "placeholder": "请选择状态",
            "dicData": DIC["menustatusDic"]
        }
    ]
};
